package es.cea.web;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet("/Estadisticas")
public class Estadisticas extends HttpServlet {
	private static final long serialVersionUID = 1L;       
    
    public Estadisticas() {
        super();
        // TODO Auto-generated constructor stub
    }
	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		Set estadisticas = (Set) request.getSession().getAttribute("estadisticas");		
		Iterator it = ((Set) estadisticas).iterator();	
		PrintWriter writer = response.getWriter();
		writer.write("<HTML><HEAD></HEAD><BODY><UL>");			
		stat aux;
		while(it.hasNext()){
			aux = (stat) it.next();
			writer.write("<LI>");
			writer.write(aux.url+" "+aux.cont);
			writer.write("</LI>");
		}
		writer.write("</UL></BODY></HTML>");
	}
	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

}
